

/**
 * 雾天气
 */

import FogShader from '../shader/FogShader.glsl?raw'
import { v4 as uuid } from 'uuid'

export default class Fog {
  /**
   * 
   * @param {*} viewer 
   */

  constructor(viewer) {
    this._viewer = viewer
    this._delegate = undefined
  }


  mounted() {
    this._delegate = new Cesium.PostProcessStage({
      name: uuid(),
      fragmentShader: FogShader,
      uniforms: {

      }
    })

  }

  /**
   * 添加后处理效果
   * @returns 
   */

  start() {
    !this._delegate && this.mounted()
    this._delegate && this._viewer.scene.postProcessStages.add(this._delegate)
    return this
  }

  /**
   * 停止渲染
   */

  stop() {
    this._delegate && this._viewer.scene.postProcessStages.remove(this._delegate)
    this._delegate = undefined
  }


}
